//3000/s  20g内存 2g cpu
const Koa = require('koa');
const app = new Koa();
app.a=0
app.t1 =  Date.now();
app.t2 =  Date.now();
// 定义一个中间件处理请求
app.use(async ctx => {
  app.a++
  if(app.a%3000==0){
    app.t2 =  Date.now();
    console.log(app.t2-app.t1,app.a)
    app.t1=app.t2
  }
  
  ctx.body = 'Hello, Koa!';
});

// 启动服务器
const port = 3000;
app.listen(port, () => {
  console.log(`Server is running at http://localhost:${port}`);
});